FROM python:3.9.5-slim-buster
MAINTAINER edgar.z

RUN pip install --upgrade pip  \
    && pip install paddlehub --upgrade  \
    && apt-get update \
    && apt-get  install libgomp1  libgl1-mesa-glx libglib2.0-dev -y 

ADD requirements.txt requirements.txt
ADD 1.png 1.png

RUN pip install -r requirements.txt \
    hub install chinese_ocr_db_crnn_server==1.1.2 \
    && hub run chinese_ocr_db_crnn_server --input_path "1.png"

RUN rm -rf /root/.cache && apt-get autoclean \
    && apt-get --purge autoremove -y git \
    && rm -rf /tmp/* /var/lib/apt/* /var/cache/* /var/log/* \
    && rm -f /PaddleOCR/inference/*.tar

EXPOSE 8866

CMD hub serving start -m chinese_ocr_db_crnn_server